package com.world.business.weapon.controller;

import com.world.business.weapon.domain.WeaponChangeLog;
import com.world.business.weapon.domain.query.WeaponChangeLogAddRequest;
import com.world.business.weapon.service.IWeaponChangeLogService;
import com.world.common.controller.BaseController;
import com.world.common.domain.ResponseData;
import com.world.common.domain.SuccessResponseData;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 装备变更记录 前端控制器
 * </p>
 *
 * @author 邓驴
 * @since 2023-09-05
 */
@Api(tags = "装备变更记录")
@RestController
@RequestMapping("/weapon/change/log")
public class WeaponChangeLogController extends BaseController<WeaponChangeLog> {

    @Resource
    private IWeaponChangeLogService weaponChangeLogService;

    @ApiOperation("获取武器的变更记录")
    @GetMapping("/{weaponId}")
    public ResponseData<List<WeaponChangeLog>> get(@PathVariable("weaponId") Long weaponId) {
        return new SuccessResponseData<>(weaponChangeLogService.get(weaponId));
    }

    @ApiOperation("新增")
    @PostMapping("")
    public ResponseData<Long> add(WeaponChangeLogAddRequest request) {
        return new SuccessResponseData<>(weaponChangeLogService.add(request));
    }

}
